<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
	<title>欢迎您登录</title>
<script>
var setting = {
     data: {
         simpleData: {
             enable: true         }
     },
     callback: {
		onClick: onClick
	}
};
function onClick(event, treeId, treeNode){
	if(treeNode.pId!=null && treeNode.pId!=""){
		var rightFrame = document.getElementById("rightFrame");
		rightFrame.src = "${ctx}"+treeNode.menuAddr;
	}
	var zTree = $.fn.zTree.getZTreeObj("treeDemo");
	zTree.expandNode(treeNode);
}
var zNodes;
$(document).ready(function(){
	 $.ajax({
          	type: "POST",    
          	url: '${ctx}/main/main/tree',                   
          	dataType: "text",     
          	global: false,
          	async: false,                      
           	success: function (data) 
           	{   
          		zNodes=eval(data);
          	},          
          	error: function () {
          		alert("Ajax请求数据失败!");
        	}
	 });
	$.fn.zTree.init($("#treeDemo"), setting, zNodes);
	var allcookies = $.cookie('mainColors');
	$('#link_theme').attr('href','${ctx}'+'/static/plugin/'+allcookies+'.css');
    $('.style_switcher a').removeClass('th_active');
    $(this).addClass('th_active');
});
 //* style switcher
    gebo_style = {
        init: function() {
            $('.style_switcher a').click(function() {
            	var newcookies = $(this).attr('title');//给cookie赋相应的值
		        $.cookie('mainColors', newcookies, { expires: 7, path: '/' });//重置名为product的cookie值 
                $('#link_theme').attr('href','${ctx}'+'/static/plugin/'+$(this).attr('title')+'.css');
                $('.style_switcher a').removeClass('th_active');
                $(this).addClass('th_active');
            });
        }
    };

function SetWinHeight(obj)

{
	var win=obj;
	if (document.getElementById)
	{
		if (win && !window.opera)
		{	
			if (win.contentDocument && win.contentDocument.body.offsetHeight) 
				win.height = win.contentDocument.body.offsetHeight; 
			else if(win.Document && win.Document.body.scrollHeight)
				win.height = win.Document.body.scrollHeight;
		}
	}
	

}

 	function resizeIframe(iHeight){
   		var mainIframeObj = document.getElementById("rightFrame");
  		mainIframeObj.style.height = iHeight+"px";
  	}

</script>
<%@ include file="script.jsp" %>

<style type="text/css">
.lftop{
	padding:43px 0px 0px 0px;
}

.lftop .ztreetop{
	padding: 65px 0px 0px 0px;
	
}

.blackTxt {
	font-weight: bold;
}
</style>
</head>
<body>
 <%@ include file="switcher.jsp" %>
 		<!--[if IE 7]>
			<div id="maincontainerIe7" class="clearfix">
		<![endif]--> 
		<!--[if !IE 7]><!--><div id="maincontainer" class="clearfix"> <!--<![endif]-->
		    <header>
				<div class="navbar navbar-fixed-top">
		            <div class="navbar-inner">
		                <div class="container-fluid">
		                    <a class="brand" href="${ctx}/main/main" ><i class="icon-home icon-white"></i>唯爱婚礼后台管理</a>
							<ul class="nav user_menu pull-right">
								<li class="divider-vertical hidden-phone hidden-tablet"></li>
								<li class="dropdown">
									<a href="${ctx}/logout" class="dropdown-toggle">退出登录 </a>
									
								</li>
							</ul>
		                    <a data-target=".nav-collapse" data-toggle="collapse" class="btn_menu">
								<span class="icon-align-justify icon-white"></span>
							</a>
		                </div>
		            </div>
		        </div>
		    </header>
		 	<div id="contentwrapper">
	          <div class="main_content">
	          		<iframe src="${ctx}/main/main/home" width="100%" height="550" scrolling="no" 
	          		frameborder="0" onload="javascirpt:SetWinHeight(this)" name="rightFrame" id="rightFrame"></iframe>				
	          </div>
	      	</div>
			<div class="sidebarleft">
				<div class="lefttop lftop">
					<a href="${ctx}/main/main/" style="text-decoration:none">
						<font color="black">功能菜单</font>
					</a>
					<ul id="treeDemo" class="ztree"></ul>
				</div>
			</div>
		</div>		
</body>
</html>
